package com.tsinghuabigdata.edu.ddmath.module.ddwork;

import android.content.Context;

import com.tsinghuabigdata.edu.ddmath.R;

import java.util.HashMap;

/**
 * 题目相关工具类
 */
public class DDWorkUtil {

    public final static String WORK_ID = "workid";
    public static final String PAGEINDEX = "index";

    //题目类型显示处理
    private static HashMap<String,String> questionHashMap = new HashMap<>();

    public static void init(Context mContext){

        //题目类型
        String qtype_ch[] = mContext.getResources().getStringArray( R.array.question_type_ch );
        String qtype_en[] = mContext.getResources().getStringArray( R.array.question_type_en );

        int minlen = qtype_ch.length <qtype_en.length ? qtype_ch.length: qtype_en.length;
        for( int i=0; i<minlen; i++ ){
            questionHashMap.put( qtype_ch[i], qtype_en[i] );
            questionHashMap.put( qtype_en[i], qtype_ch[i] );
        }
    }

    public static String getQuestionTypeName( String reason ){
        return questionHashMap.get( reason );
    }

}
